package com.draven.mall.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;

import java.util.Date;
import java.util.List;

/**
 * 商品分类实体类
 */
@Data
@TableName("tb_category")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Category {

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    
    @TableField("parent_id")
    private Long parentId;
    
    private String name;
    
    private String icon;
    
    @TableField("sort")
    private Integer sortOrder;
    
    /**
     * 状态：0-不显示，1-显示
     */
    private Integer status;
    
    @TableField(value = "created_time", fill = FieldFill.INSERT)
    private Date createTime;
    
    @TableField(value = "updated_time", fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;
    
    /**
     * 子分类，非数据库字段
     */
    @TableField(exist = false)
    private List<Category> children;
} 